package com.siemens.industrial.model.partner;

import org.springframework.jdbc.core.RowMapper;

import java.util.Date;

/**
 * Created by qupen on 2016/9/18.
 */
public class DeviceIdleInfo {
    private String deviceId;
    private String userId;
    private String idleReason;
    private String repairInfo;
    private Date startTime;
    private Date endTime;
    private Date createTime;

    private static final RowMapper<DeviceIdleInfo> rowMapper = (resultSet, i) -> {
        DeviceIdleInfo deviceIdleInfo = new DeviceIdleInfo();
        deviceIdleInfo.setDeviceId(resultSet.getString("device_id"));
        deviceIdleInfo.setUserId(resultSet.getString("user_id"));
        deviceIdleInfo.setIdleReason(resultSet.getString("idle_reason"));
        deviceIdleInfo.setStartTime(new Date(resultSet.getTimestamp("start_time").getTime()));
        deviceIdleInfo.setEndTime(resultSet.getTimestamp("end_time") == null ? null : new Date(resultSet.getTimestamp("end_time").getTime()));
        deviceIdleInfo.setCreateTime(new Date(resultSet.getTimestamp("create_time").getTime()));
        return deviceIdleInfo;
    };

    public static RowMapper<DeviceIdleInfo> getRowMapper() {
        return rowMapper;
    }

    //<editor-fold desc="getters and setters">

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getIdleReason() {
        return idleReason;
    }

    public void setIdleReason(String idleReason) {
        this.idleReason = idleReason;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getRepairInfo() {
        return repairInfo;
    }

    public void setRepairInfo(String repairInfo) {
        this.repairInfo = repairInfo;
    }

    //</editor-fold>
}
